﻿using RRKAutohaus.Model;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RRKAutohaus.Core.EntityFramework.Configuration
{
    public class CategoryConfig: EntityTypeConfiguration<Category>
    {
        //1 blog has 1 or more category
        public CategoryConfig()
        {
            HasMany(category => category.Blog)
                .WithMany(blog => blog.Category)
                .Map(m => {
                    m.MapLeftKey("CategoryId");
                    m.MapRightKey("BlogId");
                    m.ToTable("BlogCategory");
                });
        }
    }
}
